package it.traveldream.entities;

import it.traveldreamClient.beans.dto.AlloggioDTO;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Entity implementation class for Entity: Alloggio
 *
 */
@Entity
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
public class Alloggio extends Componente implements Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Column(nullable = false)
	private String citta;
	
	@Column(nullable = false)
	@Temporal(TemporalType.DATE)
	private Date checkIn;
	
	@Column(nullable = false)
	@Temporal(TemporalType.DATE)
	private Date checkOut;

	
	@OneToOne(mappedBy="Alloggio")
	private Pacchetto pk;

	public Alloggio() {
		super();
	}
	
	public Alloggio(Alloggio al){
		this.citta =al.getCitta();
		this.nome =al.getNome();
		this.Prezzo =al.getPrezzo();
		this.checkIn = al.getCheck_In();
		this.checkOut = al.getCheck_Out();
		this.Disponibilita=true;
		}
	
	public Alloggio(AlloggioDTO al){
		this.citta =al.getCitta();
		this.nome =al.getNome();
		this.Prezzo =Integer.parseInt(al.getPrezzo());
		this.checkIn = al.getCheckIn();
		this.checkOut = al.getCheckOut();
		this.Disponibilita=true;
		}
	public String getCitta() {
		return this.citta;
	}

	public void setCitta(String Citta) {
		this.citta = Citta;
	}   
	public Date getCheck_In() {
		return this.checkIn;
	}

	public void setCheck_In(Date Check_In) {
		this.checkIn = Check_In;
	}   
	public Date getCheck_Out() {
		return this.checkOut;
	}

	public void setCheck_Out(Date Check_Out) {
		this.checkOut = Check_Out;
	}
	
	public AlloggioDTO getDTO(){
		AlloggioDTO alDTO = new AlloggioDTO();
		alDTO.setRegalo(this.isRegalo());
		alDTO.setCheckIn(this.getCheck_In());
		alDTO.setCheckOut(this.getCheck_Out());
		alDTO.setCitta(this.getCitta());
		alDTO.setRegalo(isRegalo());
		alDTO.setIdProdotto(this.getIdProdotto());
		alDTO.setNome(this.getNome());
		alDTO.setPrezzo(this.getPrezzo().toString());
		alDTO.setDisponibilita(getDisponibilita());
		return alDTO;
	}

   
}
